<template>
  <div>
    <textarea v-model="problemDescription"
              class="fd-textarea"
              rows="5"
              placeholder="你的意见对我们很重要"></textarea>

    <vm-button text="提交"
               @buttonClicked="submit"></vm-button>
  </div>
</template>
<script>
import VmButton from '../../components/vm-button.vue'

export default {
  components: {
    VmButton
  },
  props: {},
  data() {
    return {
      problemDescription: ''
    }
  },
  computed: {},
  watch: {},
  created() { },
  methods: {
    submit() {
      if (!this.problemDescription) {
        return this.$notice.toast({ message: '请填写您的意见' })
      }
      const dateStr = this.$utils.dateFormat(new Date())
      this.$http({
        method: 'POST',
        name: 'auth.user.feedback',
        data: {
          problemTime: dateStr,
          problemDescription: this.problemDescription
        },
        errorMsg: '提交失败了，请重试'
      }).then(res => {
        this.$notice.toast({ message: '感谢您宝贵的意见，管理员会及时回复' })
        this.$router.back()
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.fd-textarea {
  background-color: #fff;
  color: #333;
  width: 750px;
  height: 400px;
  padding: 30px;
  margin-bottom: 30px;
  tint-color: #999;
}
</style>
